<%@ page import="javax.portlet.PortletSession" %>
<%@ page import="org.gridlab.gridsphere.services.visualization.*" %>
<%@ taglib uri="/portletUI" prefix="ui" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>

<portlet:defineObjects/>
<%
    PortletSession ps = renderRequest.getPortletSession(false);
    ChartGenerator[] chartGenerators = (ChartGenerator[]) ps.getAttribute("chartGenerators");
%>

<ui:panel>
<ui:frame align="left">
<%
for(int i=0; i<chartGenerators.length; ++i) {
    try {
        chartGenerators[i].setWidth(600);
        if(chartGenerators[i].isDataproviderOK()) {
            out.print("<h2>");
            out.print(chartGenerators[i].getClass().getName().replaceAll(".*\\.",""));
            out.println("</h2>");
            out.flush();
            chartGenerators[i].embedChart(renderRequest, renderResponse);
        }
    } catch(ChartGeneratorException e) {
        out.println("<pre>");
        out.println(e);
        out.println("</pre>");
    } catch(NullPointerException e) {
        out.println("<p>chartGenerator is null!</p>");
    } catch(Exception e) {
        throw e;
    }
}
%>
</ui:frame>
<ui:frame align="left">
<ui:form>
<ui:actionsubmit action="backToViewPage" value="back!"/>
</ui:form>
</ui:frame>
</ui:panel>

